---
category: Validator
contributors:
    - sadirde
    - tugsanunlu
created: '2020-05-07'
title: Check if a number is negative
updated: '2021-10-13'
---

**JavaScript version**

```js isNegative.js
const isNegative = (n) => Math.sign(n) === -1;

// Or
const isNegative = (n) => n < 0;
```

**TypeScript version**

```ts isNegative.ts
const isNegative = (n: number): boolean => Math.sign(n) === -1;

// Or
const isNegative = (n: number): boolean => n < 0;
```

**Examples**

```js examples.js
isNegative(-3); // true
isNegative(8); // false
```
